package com.nengchuan.kbms.dfs.controller.work;


import com.nengchuan.kbms.dfs.annotation.UserOperateLogger;
import com.nengchuan.kbms.dfs.entity.vo.OperateTopVO;
import com.nengchuan.kbms.dfs.service.UserOperateHistoryService;
import com.nengchuan.model.model.WrappedResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 用户操作历史 前端控制器
 * </p>
 *
 * @author abe
 * @since 2020-04-01
 */
@RestController
@RequestMapping("/work/station")
@Api(tags = "知识库数据后台管理 > 工作管理 > 我的工作站 【已完成】")
public class StationController {

    @Autowired
    private UserOperateHistoryService userOperateHistoryService;

    @GetMapping("/download/top")
    @ApiOperation(value = "下载排行")
    public WrappedResult<List<OperateTopVO>> downloadTop() {
        return WrappedResult.success(userOperateHistoryService.operateTop(UserOperateLogger.Type.DOWNLOAD));
    }

    @GetMapping("/preview/top")
    @ApiOperation(value = "浏览排行")
    public WrappedResult<List<OperateTopVO>> previewTop() {
        return WrappedResult.success(userOperateHistoryService.operateTop(UserOperateLogger.Type.PREVIEW));
    }

}
